 // 父类
class Aniaml{
  name:string
  age:number
  constructor(name:string,age:number){
    this.name=name
    this.age=age
  }
  sayHi(str:string){
    console.log('hi,'+str)
  }
}

class Dog extends Aniaml{
  love: string // 父类中没声明，子类要补上
  constructor(name:string,age:number,love:string){
    super(name,age)
    this.love=love
  }
  sayHi(){
    console.log('hi,'+this.name)
  }
  myLove(){
    console.log(this.name+'爱好'+this.love);
    super.sayHi('父类的sayHi')
    // super.可以在子类中调用父类方法
  }
}

const Dog1=new Dog('小猫',18,'吃鱼')

Dog1.myLove()
Dog1.sayHi()